#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
bool flag[1000000];
int main(){
    int n;
    scanf("%d",&n);
    memset(flag,0,sizeof(bool)*1000000);
    for(int i=2;i<=n;++i){
        if(i==2){
            int j=2;
            while(j*i<=n){
                flag[j*i]=1;
                ++j;
            }
        }else {
            if(flag[i]==0){
               int j=2;
               while(j*i<=n){
                flag[j*i]=1;
                ++j;
                }
            }
        }
    }
    //for(int i=2;i<=n;++i){
      //  printf("%d  %d\n",i,flag[i]);
    //}
    int l=0;
    for(int i=2;i<=n;++i){
        if(flag[i]==0){
            l++;
            if(l==1){
             printf("%d",i);
            }else{
             printf(" %d",i);
            }

        }
    }
    printf("\n%d\n",n-l-1);
    return 0;
}
